Device simulation is used in computers system to mimic the behavior of missing or incompatible devices. In one approach to simulating devices, a hypervisor that supports execution of virtual machines (VMs) also performs device simulation. In such systems, if a VM attempts to access a device, such as a serial port, then the hypervisor traps the access and simulates the device. However, other computer systems may not include hypervisors because a hypervisor is not running or the hardware does not have a hypervisor mode, or the hypervisor itself requires the use of a simulated device. Consequently, a more general and flexible approach to simulating devices in computer systems with or without hypervisors is desirable.